package com.david.func_test.view

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.util.Log
import android.view.View

class MoreArrowView: View {
    val paint = Paint()

    init {
        paint.color = Color.parseColor("#24292b")
        paint.textSize = 28f
    }


    private var isExpend = false

    constructor(context: Context, attr: AttributeSet): super(context, attr) {

    }

    override fun onDraw(canvas: Canvas) {
        //super.onDraw(canvas)
        Log.e("more", "width:${width}")
        if (width > 200) {
            //canvas.drawText("释放", (width - textWidth) / 2, (height) / 2 - textHeight / 2, paint)
            //canvas.drawText("查看", (width - textWidth) / 2, (height) / 2 + textHeight, paint)

            isExpend = true
        } else {
            //canvas.drawText("更多", (width - textWidth) / 2, (height) / 2 + textHeight/ 3, paint)
        }
    }

    fun getExpend(): Boolean {
        val temp = isExpend
        isExpend = false
        return temp
    }
}